home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Info-Mac 4
/
Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso
/
Development
/
General
/
ViewIt™ 2.24 Shareware
/
C++ Demo Projects
/
Symantec C++ 6.0 Demos
/
FaceProcSC.cp
next >
Wrap
Text File
|
1994-01-27
|
3KB
|
89 lines
/* FaceWare 2.2 Initialization & Dispatching Procedures */
/* ©FaceWare 1989-93. All Rights Reserved. */
#include "FaceStorSC.h"
struct FaceRec fRec;
typedef struct HeadRec {
ProcPtr addr;
short baseID;
short versID;
short message;
short resID;
Ptr fPtr;
} HeadRec, *HeadPtr;
void PrepIt (long x, long b, long v, long r, long f)
{
short i;
((HeadPtr)x)->addr = (ProcPtr)*GetResource('FCMD',1000);
((HeadPtr)x)->baseID = b;
((HeadPtr)x)->versID = v;
((HeadPtr)x)->message = 0;
((HeadPtr)x)->resID = r;
((HeadPtr)x)->fPtr = (Ptr)f;
if (fRec.xEntries > 0)
for (i = 0; i <= fRec.xEntries - 1; i++)
if (((HeadPtr)x)->baseID == fRec.xTable[i * 4])
if (((HeadPtr)x)->versID == fRec.xTable[1 + i * 4])
if (fRec.xTable[3 + i * 4] != 0)
((HeadPtr)x)->addr = (ProcPtr)fRec.xTable[3 + i * 4];
}
pascal void fJumpIt(void* thePtr) = {0x2257,0x2051,0x4E90};
void FaceIt (void* thePtr, long m1, long m2, long m3, long m4, long m5)
{
short i;
if (m1 == DoInit) {
if (m4 > -1 && !BitTst(&m4, 31L)) {
FlushEvents(62, 0); /* ignore spurious mouse and key events */
InitGraf(&thePort); /* perform appropriate Mac initializations */
InitFonts();
InitWindows();
InitMenus();
TEInit();
InitDialogs(0L);
}
CtoPstr(fRec.uName);
if (GetResource('FCMD', 1000) == 0) /* LoadIt available? */
if (OpenResFile((StringPtr)StripAddress((Ptr)fRec.uName)) < 0)
ExitToShell(); /* quit if not found */
fRec.fFlags = m2; /* store FaceIt bit flags */
fRec.xEntries = m5; /* store # of table entries */
thePtr = (Ptr)&fRec;
if (m3 > -1) { /* call LoadIt to expand heap? */
PrepIt((long)thePtr,m3,0L,0L,(long)thePtr);
fJumpIt(thePtr);}
PrepIt((long)thePtr,1100L,22L,0L,(long)thePtr); /* setup fRec header */
PrepIt((long)fRec.uHead,1210L,22L,0L,(long)thePtr); /* setup uRec header */
PrepIt((long)fRec.vHead,1200L,22L,0L,(long)thePtr); /* setup vRec header */
fRec.fHead[5] = m4; /* store environment type */
fRec.uHead[5] = 1; /* store string type */
thePtr = 0L;
if (m4 < -3) return;
}
if (m1 == DoPrep)
PrepIt(m2, m3, m4, m5, (long)&fRec);
else if (m1 < 0 && m1 > -11) {
i = (4 * (-1 - m1));
fRec.xTable[i] = m2;
fRec.xTable[1 + i] = m3;
fRec.xTable[2 + i] = m4;
fRec.xTable[3 + i] = m5;}
else {
if (thePtr == 0L) /* default module? */
thePtr = (Ptr)fRec.uHead;
else if (((HeadPtr)thePtr)->fPtr != (Ptr)&fRec) { /* control driver? */
fRec.cControl = (ControlHandle)thePtr;
thePtr = (Ptr)fRec.vHead;}
((HeadPtr)thePtr)->message = 0;
fRec.uCommand = m1; /* pass Command & Params */
fRec.uParam[0] = m2;
fRec.uParam[1] = m3;
fRec.uParam[2] = m4;
fRec.uParam[3] = m5;
fJumpIt(thePtr); /* jump to FCMD module */
}
}